package com.jh.paymentchannel.service.freeQuick;

import cn.jh.common.exception.ServiceException;
import cn.jh.common.pay.jdpush.PayBarException;
import com.jh.paymentchannel.pojo.freeQuick.FreeQuickOrder;
import com.jh.paymentchannel.pojo.freeQuick.FreeQuickWithdraw;
import com.jh.paymentchannel.pojo.freeQuick.FreeQuickWithdrawTemp;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface FreeQuickPayService {

    /**
     * 交易支付
     * @param freeQuickOrder
     * @throws Exception
     */
    Map payment(FreeQuickOrder freeQuickOrder) throws Exception;

    List<FreeQuickWithdraw> getAllInProcessPay();

    List<FreeQuickOrder> getAllInProcessPayStatus();

    void queryWithdraw(String requestNo,String merchantNo);

    /**
     * 提现
     * @param freeQuickWithdraw
     * @return
     * @throws Exception
     */
    Map withdraw(FreeQuickWithdraw freeQuickWithdraw)throws Exception;

    /**
     * 查询通道
     * @param requestNo
     * @param merchantNo
     */
    void queryPay(String requestNo,String merchantNo);

    /**
     * 生成临时提现任务
     * @param freeQuickWithdraw
     */
    void saveWithdraw(FreeQuickWithdrawTemp freeQuickWithdraw);


    /**
     * 提现查询
     * @param entity
     * @return
     * @throws Exception
     */
    Map querywithdraw(FreeQuickWithdraw entity) throws ServiceException;

    /**
     * 交易查询
     * @param freeQuickOrder
     * @return
     * @throws Exception
     */
    Map querypayment(FreeQuickOrder freeQuickOrder) throws ServiceException;

    Map<String, Object> balanceWithdraw(FreeQuickWithdraw entity, BigDecimal balance, String bankCard, BigDecimal rate, BigDecimal extraFee) throws ServiceException;

    void processPayNotify(FreeQuickOrder freeQuickOrder) throws PayBarException;

    void processPaywithdraw(FreeQuickWithdraw freeQuickWithdraw) throws PayBarException;

    BigDecimal getTodayIncome(String userId) throws ServiceException;

    Page<FreeQuickOrder> findPassagewayOrderPage(String startTime, String endTime, String requestNo, String merchantNo, String channelProductCode,
                                                 String bankCardNo, String productName, String channelType, String payStatus, String userId,
                                                 String payType, Pageable pageable) throws ServiceException;

    Page<FreeQuickWithdraw> findFreeQuickWithdrawPage(String userId, String requestNo, String merchantNo, String channelCode, String bankAccountNo,
                                                      String bankAccountName, String bankAccountType, String bankName, String bankSubName, String bankProvince,
                                                      String bankCity, String withdrawRequestNo, String payType, String channelType, String payStatus,
                                                      String startTime, String endTime, Pageable pageable);

    void queryAndUpdateFreeQuickOrderJob() throws ServiceException;

    void queryAndUpdateFreeQuickWithdrawJob() throws ServiceException;

    List<FreeQuickWithdrawTemp> queryWithdrawTemp();

    Page<FreeQuickWithdraw> rechargePage(String userId, String status, Pageable pageable) throws ServiceException;

     Map taskWithdraw(FreeQuickWithdraw freeQuickWithdraw) throws ServiceException;

    Map<String, Object> queryWithDraw(String merchantNo, String requestNo) throws ServiceException;

    Map<String, Object> noCardRebatePage(String phone, String requestNo, String channelTag, String startTime, String endTime, Pageable pageable) throws ServiceException;

    Map<String,String> queryMerct(String phone);

    Map<String, Object> appNoCardRebatePage(long userId, Pageable pageable) throws ServiceException;
}
